package main

import (
	"fmt"
)

func main() {

	s := Student{sub: 1, sid: 2, name: "我是小尾巴", Person: Person{name: "小王吧", age: 26}}

	aa := *&s.Person

	fmt.Println(s, *&aa.name)

	test(&s)

	fmt.Println(s)

	fmt.Println(s.getName())

	s.setName("setName")

	fmt.Println(s.getName())

	in := Integer(10)

	fmt.Println(in.sum(10))


}

type Person struct {
	name string

	age int
}

type Student struct {
	//匿名字段
	Person

	// 学号
	sid int

	// subject
	sub int

	name string
}

func (n Student) getName() (name string) {

	return n.name
}
func (n Student) setName(name string) () {

	n.name = name
}

type Integer int

func (in Integer) sum(des Integer) (res Integer) {

	if des == 0  {

		return in
	}

	res = in + des


	return res
}

func test(student *Student) {

	student.name = "test"
	student.Person.name = "test22222222222"

	fmt.Println("name is ", student)
}
